(function () {
  // 步骤3：创建echarts实例
  let myChart = echarts.init(document.querySelector(".box6"));

  console.log(myChart);

  // 步骤4：定义配置（指定图表的配置项和数据）
  let option = {
    // title: {
    //   text: "Stacked Area Chart",
    // },
    tooltip: {
      trigger: "axis",
      axisPointer: {
        type: "cross",
        label: {
          backgroundColor: "#6a7985",
        },
      },
    },
    legend: {
      data: ["Email", "Union Ads", "Video Ads", "Direct", "Search Engine"],
      textStyle: {
        color: "#666e8c",
      },
    },
    grid: {
      left: "3%",
      right: "4%",
      bottom: "3%",
      // containLabel: true,
    },
    xAxis: [
      {
        type: "category",
        boundaryGap: false,
        data: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
        axisLine: { show: true },

        splitLine: { show: false },
      },
    ],
    yAxis: [
      {
        type: "value",
      },
    ],
    series: [
      {
        name: "Union Ads",
        type: "line",
        stack: "Total",
        areaStyle: {},
        emphasis: {
          focus: "series",
        },
        normal: {
          color: "#fff", //改变区域颜色
        },

        data: [220, 182, 191, 234, 290, 330, 310],
      },
      {
        name: "Search Engine",
        type: "line",
        stack: "Total",
        label: {
          show: true,
          position: "top",
        },
        areaStyle: {},
        emphasis: {
          focus: "series",
        },
        data: [120, 232, 101, 194, 290, 330, 320],
      },
    ],
  };

  // 步骤5：使用刚指定的配置项和数据显示图表
  myChart.setOption(option);

  window.onresize = function () {
    myChart.resize();
  };
})();
